Passed
Branch feature/phase1 (a6d58a)
by Pieter Epeüs
09:26 queued 43s
created

multikey.js ➔ multikey   A

Complexity

Conditions 4

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 15
rs 10
c 0
b 0
f 0
cc 4
1
export default function multikey(original, key) {
2
    return original.map((value) => {
3
        const item = {};
4
5
        if (typeof key === 'object') {
6
            key.forEach((itemKey) => {
7
                item[itemKey] = value[itemKey];
8
            });
9
10
            return item;
11
        }
12
13
        return value[key];
14
    });
15
}
16